// Object.assign 方法  
const source ={
    a: 1,
    b: 2
}

const target = {
    a:4,
    c:6
}

const result = Object.assign(target, source)
console.log(result)
console.log(result === target)


const fun = (obj)=>{
    // obj.name = 'func obj'
    // console.log(obj)
    const funObj = Object.assign({},obj)
    funObj.name  = 'func obj'
    console.log(funObj)
}

const obj = { name: 'global obj'}
fun(obj)
console.log(obj)